You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Probe container's IP and forwarded IP for urcap endpoint - #614
In some situations, we might want to probe for the container's IP, while in other setups we might want to probe the forwarded http port on the host. Before, the host forward was used as soon as it was specified. With this change both are probed and the one that answers with a 200 status code is picked for installing the urcap.
In some situations, we might want to probe for the container's IP, while
in other setups we might want to probe the forwarded http port on the host.
Before, the host forward was used as soon as it was specified. With this
change both are probed and the one that answers with a 200 status code
is picked for installing the urcap.
❌ Patch coverage is 76.66667% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.44%. Comparing base (d14edd7) to head (e144383).
✅ All tests successful. No failed tests found.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
On UrService timeout, startup exits without stopping the launched container, leaving URSim holding its name and ports and blocking retries even in foreground mode.
This PR makes URCap installation work across container-network and host-forwarded setups by selecting an UrService endpoint that responds with HTTP 200.
Changes:
Probe the container IP first, then the forwarded HTTP endpoint.
Add a configurable readiness timeout and propagate setup failure.
Update tests for container-IP preference, forwarded-endpoint fallback, and timeout behavior.
File
Description
tests/test_start_ursim.bats
Tests endpoint selection and UrService timeout handling.
scripts/start_ursim.sh
Probes available endpoints, bounds readiness waiting, and exits on setup failure.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The readiness loop can exceed the configured deadline and install after it expires, while the endpoint test does not specifically verify that the installation POST uses the forwarded URL.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Enforce the deadline for each probe and skip expired retries
scripts/start_ursim.sh:439
The deadline is checked only before a full round of probes, so URSIM_URSERVICE_TIMEOUT=1 can still wait roughly eleven seconds if both requests reach their five-second limit. A successful forwarded probe can also trigger installation after the deadline has expired. Check the remaining budget before each probe, cap its timeout to that budget, and skip the retry sleep once the deadline expires.
Assert the installation POST uses the forwarded URL
tests/test_start_ursim.bats:1039
This assertion also matches the forwarded readiness probe, so the test still passes if the installation POST uses the unreachable container IP or is omitted entirely. Assert the forwarded URL on the POST entry specifically, so this test verifies that the selected endpoint is actually used to install the URCap.
urfeex
changed the title
Probe container's IP and forwarded IP for urcaps endpoint
Probe container's IP and forwarded IP for urcap endpoint
Nov 3, 2026
Low Risk
Changes are limited to the URSim startup script and its tests, improving Docker/CI connectivity without touching robot control or auth paths.
Overview
PolyScope X startup no longer assumes a published host port is the right way to reach UrService. post_setup_polyscopex builds a list of candidate bases (container IP first, plus the forwarded docker port endpoint when present), polls the UrService urcaps API on each until one returns 200, and uses that URL for the URCapX POST. Waiting is bounded by URSIM_URSERVICE_TIMEOUT (default 300s); on timeout the script prints what was tried and returns failure.
main now treats post-setup failure as fatal: in non-detached mode it stops the URSim container before exiting. Bats coverage adds cases for preferring the container IP, falling back to the forwarded endpoint, and timing out.
Reviewed by Cursor Bugbot for commit e144383. Bugbot is set up for automated code reviews on this repo. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In some situations, we might want to probe for the container's IP, while in other setups we might want to probe the forwarded http port on the host. Before, the host forward was used as soon as it was specified. With this change both are probed and the one that answers with a 200 status code is picked for installing the urcap.